turtles-own

 

Turtles-own defines variables that belong to all turtles in a model. The variables are usually a trait or aspect specific to the turtle, like is-hungry? or energy. Like global variables and other agent variables, it must be defined at the top of your code, before any procedure definitions. It has the form of turtles-own [ variable1 variable2 ... ].You can define one variable or multiple, but they must all be within the brackets.

If you have defined multiple breeds of turtles, turtles-own will apply the variable to all breeds. However, you can define a variable for a specific breed by using <breed>-own, where is the name of your breed. For example, if you have already defined a breed of turtles by breed [birds bird], you can create a variable for only birds by using birds-own [wing-size].

 

Try it Yourself

 
 
 
 
 
 
 

What's next?

Once you mastered the turtles-own primitive, don't stop there. Check out the resources below to improve your NetLogo skills.

 
Published NetLogo models that use the turtles-own primitive:
 
 
Similar primitives:
set

Set the value of a variable.

Read more
of

report the value of an agent-owned variable from another context

Read more
patches-own

Declare a variable that belongs to patches.

Read more
globals

defines variables that can be used throughout the whole model

Read more
 
Learn another primitive